home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
TCL1
/
CSTATUSB
/
MAIN.C
< prev
Wrap
C/C++ Source or Header
|
1992-07-19
|
2KB
|
111 lines
/*****
* CStatusBar.c
* Status bar graph class by Joe Zobkiw
*
* This code is free and in the public domain, if you use it, please mention
* so in your About Box.
*
* Suggestions or bugs: AFA Zobkiw @ America Online
*
*****/
#include "CStatusBar.h"
#include "oops.h"
main()
{
DialogPtr myDialog;
Boolean dialogDone = FALSE;
int percent, itemHit;
CStatusBar *myStatusBar, *myOtherStatusBar, *myThirdStatusBar, *mySkinnyStatusBar;
RGBColor rgb;
Boolean filled = FALSE;
InitGraf(&thePort);
InitFonts();
FlushEvents(everyEvent,0);
InitWindows();
InitMenus();
TEInit();
InitDialogs(0L);
InitCursor();
myStatusBar = new( CStatusBar );
myOtherStatusBar = new( CStatusBar );
myThirdStatusBar = new( CStatusBar );
mySkinnyStatusBar = new( CStatusBar );
myDialog = GetNewDialog(128,0L,-1L);
ShowWindow(myDialog);
rgb.red = 0;
rgb.blue = 65535;
rgb.green = 0;
myStatusBar->IStatusBar( myDialog, 2, TRUE, FALSE, TRUE, rgb );
myOtherStatusBar->IStatusBar( myDialog, 10, FALSE, FALSE, FALSE, rgb );
rgb.red = 0;
rgb.blue = 0;
rgb.green = 65535;
mySkinnyStatusBar->IStatusBar( myDialog, 12, FALSE, TRUE, TRUE, rgb );
rgb.red = 65535;
rgb.blue = 0;
rgb.green = 0;
myThirdStatusBar->IStatusBar( myDialog, 11, TRUE, TRUE, TRUE, rgb );
while ( dialogDone == FALSE )
{
ModalDialog( 0L, &itemHit );
switch(itemHit)
{
case 1:
DisposDialog( myDialog );
dialogDone = TRUE;
break;
case 3:
if ( filled ) {
Alert( 128, 0L );
myStatusBar->Draw();
myOtherStatusBar->Draw();
myThirdStatusBar->Draw();
mySkinnyStatusBar->Draw();
filled = FALSE;
} else {
for (percent = 0; percent < 100; percent++ ) {
myStatusBar->Update( percent );
myOtherStatusBar->Update( percent );
myThirdStatusBar->Update( percent );
mySkinnyStatusBar->Update( percent );
Delay( 1, 0L ); /* just for a slower effect */
}
SysBeep(0);
filled = TRUE;
}
break;
case 4:
myStatusBar->Draw();
myOtherStatusBar->Draw();
myThirdStatusBar->Draw();
mySkinnyStatusBar->Draw();
filled = FALSE;
break;
case 9:
Alert( 129, 0L );
myStatusBar->Draw();
myOtherStatusBar->Draw();
myThirdStatusBar->Draw();
mySkinnyStatusBar->Draw();
filled = FALSE;
break;
default:
break;
}
}
delete( myStatusBar );
delete( myOtherStatusBar );
delete( myThirdStatusBar );
delete( mySkinnyStatusBar );
}